package com.nx.vip.javacore.reflection;

import javax.swing.*;

public class SingleDemo {

    private static SingleDemo instance; //

    private SingleDemo(){
        if (instance!=null){
            throw new RuntimeException("这是一个单例，不能重复创建...");
        }
    }

    public static  SingleDemo getInstance(){
        if(instance == null){
            instance = new SingleDemo();
        }
        return instance;
    }
}
